package TwentyOne.Class.Jc;

/*
 * 进行各种其它统计的设计。
 */
class StringUtil1 {

    private String content;  //需要保存字符农村

    public StringUtil1(String content) {
        this.content = content;
    }

    public String getContent() {
        return this.content;
    }

    public String getInfo() {  //默认的信息返回
        return this.getContent();
    }
}

class StringContent extends StringUtil1 {

    private int nCount;
    private int oCount;

    public StringContent(String content) {
        super(content);
        this.countChar();  //构造方法统计
    }

    public void countChar() {
        char[] data = super.getContent().toCharArray(); //将字符串变为字符数组
        for (int i = 0; i < data.length; i++) {
            if (data[i] == 'n' || data[i] == 'N') {
                this.nCount++;
            }
            if (data[i] == 'o' || data[i] == 'O') {
                this.oCount++;
            }
        }
    }

    public int getNCount() {
        return this.nCount;
    }

    public int getNCount() {
        return this.oCount;
    }

    public String getInfo() {
        return "字母n的个数：" + this.nCount + "、字母o的个数：" + this.oCount;
    }
}

public class a15_Ex2 {

    public static void main(String[] args) {
        StringContent sc = new StringContent("want you to know one thing");
        System.out.println(sc.getInfo());
    }
}
